Skip to content

Conversation

@shawnbot
Copy link
Contributor

This PR adds a little suite of JS (CLI) scripts to manage bumping versions for all updated (according to Lerna, anyway) packages in a given release candidate.

  • script/get-packages can more reliably get (and list, when run directly) all of the package directories by un-globbing the patterns in lerna.json and filtering the matched files by whether they contain a package.json. Previously, we were doing this with hard-coded globs like modules/*, which broke down as soon as we introduced the tools directory.
  • script/get-release-version can be used to test that the release version we think we should be publishing is correct, and warns if the primer-css/package.json doesn't match. E.g. if we're on the release-9.6.0 branch and the version field in primer-css/package.json isn't 9.6.0, then we should see a warning in the CI output.
  • script/release-candidate is now a Node script that uses the two above scripts (as JS imports) to list the packages and determine the correct release version, filters by the list that Lerna thinks are "updated", and "reserves" a prerelease for each with the rc identifier by incrementing the -rc.x suffix until it finds an un-published version on npm. Finally, for each updated module, it updates all of the dependent package versions in their dependencies fields so that the published release candidate references all of the . I'm fairly certain that this is not 100% bullet-proof because it doesn't "correctly" walk the entire dependency tree, but it's way better than what we had before.

I've also moved the Yeoman generator into the tools directory to test this out.

/cc @primer/ds-core

@shawnbot shawnbot requested a review from jonrohan October 12, 2017 04:58
@shawnbot
Copy link
Contributor Author

shawnbot commented Oct 12, 2017

One thing that would be good to add to script/release-candidate is the ability to do a "dry run" so that either no package.json files would be updated or the npm publish commands wouldn't run for each updated package. To test this locally, though, you can change publish to pack here:

https://github.com/primer/primer-css/blob/9fef0d2ad266deb37df5ce3b58b4eca75d8420ef/script/release-candidate#L127-L133

This (npm pack vs. npm publish) will not update each module's package.json, but instead generate a versioned tarball for each module, suitable for upload to the npm registry. (You can also comment out that whole then() call above.)

@jonrohan jonrohan merged commit 97f874c into release-9.6.0 Oct 23, 2017
@jonrohan jonrohan deleted the better-rc branch October 23, 2017 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants